package com.xiaolin.springsecurity.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xiaolin.springsecurity.mapper.SystemUserMapper;
import com.xiaolin.springsecurity.model.SystemUser;
import com.xiaolin.springsecurity.service.SystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xiaolin
 * @description 描述
 * @since 2024/5/7
 */
@Service
public class SystemUserServiceImpl implements SystemUserService {
    @Autowired
    private SystemUserMapper systemUserMapper;

    @Override
    public SystemUser getUser(String username) {
        return systemUserMapper.selectOne(new LambdaQueryWrapper<SystemUser>()
                .eq(SystemUser::getUsername, username));
    }

    @Override
    public List<SystemUser> getUsers() {
        return systemUserMapper.selectList(null);
    }
}
